package cn.tedu.boot41.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    @RequestMapping("/test01")
    public String test01(){

        return "接收到了请求！";
    }


    @RequestMapping("/test02")
    public String test02(String info){
        return "接收到了"+info;
    }

    @RequestMapping("/bmi")
    public String bmi(float height,float weight){
        System.out.println("height = " + height + ", weight = " + weight);
        /*计算出bmi的值     bim=体重/（身高*身高）*/
        double bmi =weight/(height*height);
        // 偏瘦18.5 标准 24 微胖 28 肥胖
        if (bmi<18.5){
            return "兄弟你瘦了";
        }else if(bmi<24){
            return "身体倍棒";
        }else if(bmi<28){
            return "微微胖";
        }else{
            return "兄弟动起来";
        }
    }


    @RequestMapping("/check")
    public String check(String username){
        System.out.println("username = " + username);
        if(username.equals("tom")){
            return "用户名已存在！";
        }
        return "用户名可用！";
    }

}
